Ethereum Projects for Beginners: Build blockchain-based cryptocurrencies, smart contracts, and DApps by Kenny Vaneetvelde

Ethereum Projects for Beginners: Build blockchain-based cryptocurrencies, smart contracts, and DApps by Kenny Vaneetvelde

Author:Kenny Vaneetvelde [Vaneetvelde, Kenny]
Language: eng
Format: epub
Tags: COM043000 - COMPUTERS / Networking / General, COM004000 - COMPUTERS / Intelligence (AI) and Semantics, COM018000 - COMPUTERS / Data Processing
Publisher: Packt Publishing
Published: 2018-07-24T23:00:00+00:00


We will then move on to the withdraw function. There has to be some amount of caution while implementing this, because we first need to multiply with a currency multiplier that has been set in the contract function. Then we will proceed to deduct the balance of the executor of the transaction with the amount that needs to be withdrawn. The amount will be divided by the conversion rate. The code for this is as follows:

function withdraw(uint amount) public {

amount = amount * CURRENCY_MULTIPLIER;

balances[msg.sender] -= amount;

msg.sender.transfer(amount / conversionRate);

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.